<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>新增医师</title>
    <link
      rel="stylesheet"
      href="../../static/bootstrap/css/bootstrap.min.css"
    />
    <link rel="stylesheet" href="../../static/css/global.css" />
    <link rel="stylesheet" href="../../static/css/patient.css" />
  </head>

  <body>
    <!-- 弹窗组件 -->
    <div th:replace="~{reuse/alertBox::alertBox}"></div>
    <!-- 导航栏 -->
    <div th:replace="~{homepageFA::adminHomeNav}"></div>

    <main class="mainBox" th:fragment="doctorManage">
      <div class="container shadow-md-sm">
        <form
          action="#"
          th:action="@{/admin/doctorManage/addDoctor}"
          method="post"
          id="registerForm"
          class="container"
        >
          <div class="row justify-content-center mb-3 label">
            <label for="name" class="col-4 col-md-1 col-form-label">
              姓名
            </label>
            <div class="col-8 col-md-7">
              <input
                type="text"
                class="form-control"
                th:value="${user}!=null?${user.name}:null"
                placeholder="请输入您的姓名"
                name="name"
              />
            </div>
          </div>
          <div class="row justify-content-center mb-3 label">
            <label for="sex" class="col-4 col-md-1 col-form-label">
              性别
            </label>
            <div class="col-8 col-md-7">
              <select
                th:style="${user}!=null?'pointer-events: none':''"
                name="sex"
                class="form-select"
              >
                <option
                  th:selected="${user}!=null?${user.sex == '男性'}:false"
                  value="男性"
                >
                  男性
                </option>
                <option
                  th:selected="${user}!=null?${user.sex == '女性'}:false"
                  value="女性"
                >
                  女性
                </option>
              </select>
            </div>
          </div>
          <div class="row justify-content-center mb-3 label">
            <label for="birthday" class="col-4 col-md-1 col-form-label">
              年龄
            </label>
            <div class="col-8 col-md-7">
              <input
                type="text"
                class="form-control"
                th:value="${user}!=null?${user.birthday}:null"
                placeholder="请输入您的年龄 YYYY-MM-DD"
                name="birthday"
              />
            </div>
          </div>
          <div class="row justify-content-center mb-3 label">
            <label for="idcard" class="col-4 col-md-1 col-form-label">
              身份证号
            </label>
            <div class="col-8 col-md-7">
              <input
                type="text"
                class="form-control"
                th:value="${user}!=null?${user.idcard}:null"
                placeholder="请输入您的身份证号"
                name="idcard"
              />
            </div>
          </div>
          <div class="row justify-content-center mb-3 label">
            <label for="role" class="col-4 col-md-1 col-form-label">
              角色
            </label>
            <div class="col-8 col-md-7">
              <input
                type="text"
                class="form-control"
                disabled
                th:value="DOCTOR"
                placeholder="请输入您的身份证号"
                name="role"
              />
            </div>
          </div>
          <div class="row justify-content-center mb-3 label">
            <label for="section" class="col-4 col-md-1 col-form-label">
              科室
            </label>
            <div class="col-8 col-md-7">
              <input
                type="text"
                class="form-control"
                th:value="${user}!=null?${user.section}:null"
                placeholder="请确定所属科室"
                name="section"
              />
            </div>
          </div>
          <div class="row justify-content-center mb-3 label">
            <label for="position" class="col-4 col-md-1 col-form-label">
              职位
            </label>
            <div class="col-8 col-md-7">
              <input
                type="text"
                class="form-control"
                th:value="${user}!=null?${user.position}:null"
                placeholder="请确定现任职位"
                name="position"
              />
            </div>
          </div>
          <div class="hiddenFields">
            <input
              style="display: none"
              type="tel"
              name="id"
              th:if="${user}!=null"
              th:value="${user.id}"
            />
            <input type="hidden" name="type" th:value="${user}!=null?2:1" />
          </div>
          <div class="row justify-content-center mt-5">
            <div class="col-3 col-md-2">
              <button type="button" class="btn btn-outline-primary">
                <a href="/admin/doctorManage">返回</a>
              </button>
            </div>
            <div class="col-3 col-md-2">
              <button
                type="submit"
                class="btn btn-primary"
                th:text="${user}==null?'提交':'更新'"
              >
                提交
              </button>
            </div>
          </div>
        </form>
      </div>
    </main>
    <script src="../../static/bootstrap/js/bootstrap.bundle.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script th:inline="javascript"></script>
    <script type="text/javascript"></script>
  </body>
</html>
